<template>
    <div class="login">
        <div class="img">
            <img src="../assets/imgs/login/legend.png" alt="">
        </div>
        <div class="form">
            <el-form ref="formRef" :model="formLabelAlign" label-width="80px" label-position="left">
                <el-form-item label="用户名">
                    <el-input v-model="formLabelAlign.count"></el-input>
                </el-form-item>
                <el-form-item label="密码">
                    <el-input v-model="formLabelAlign.password"></el-input>
                </el-form-item>
                <el-form-item label-width="0">
                    <el-button @click="reset">重置</el-button>
                    <el-button type="primary" @click="login">登录</el-button>
                </el-form-item>
            </el-form>
        </div>

    </div>
</template>

<script>
    import {Login} from '../api/ask'
    export default {
        name: "Login",
        data(){
            return{
                codeSrc:'',
                formLabelAlign:{count:'',password:''},

            }
        },
        methods:{
            async login(){
                // this.$router.push('/')
                console.log("开始请求")
                let data=JSON.stringify(this.formLabelAlign)
               await Login(data).then((res)=>{
                    console.log(res)
                   this.$router.push('/')
                })
            },
            reset(){
                this.formLabelAlign={count:'',password:''}
            }
        },
    }
</script>

<style scoped lang="less">
    .login{
        width: 100%;
        height: 100%;
        background: url('../assets/imgs/login/bg.png') no-repeat;
        background-size: cover;
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
    }
    .form{
        margin-left: 200px;
        background-color: white;
        padding: 50px;
        border-radius: 15px;
        color: black;
    }
    .code{
        flex: 1;
        img{
            width: 50px;
        }

    }
    .input{
        flex: 2;
    }
    .el-button{
        flex: 1;
    }
</style>
